package com.example.weixincommonlog.config;

import com.example.weixincommonlog.interceptor.SysLogInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @version 1.0.0
 * @className: WebMvcConfig
 * @description: 拦截器注册到mvc
 * @author: zhangjunfa
 * @date: 2023/7/5 16:02
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    private final SysLogInterceptor sysLogInterceptor;

    public WebMvcConfig(SysLogInterceptor sysLogInterceptor) {
        this.sysLogInterceptor = sysLogInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(sysLogInterceptor).addPathPatterns("/**");
    }
}
